

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="adminmain" />
        <title>SMF Administration - Content Management</title>
    </head>
    <body>

        <div class="body">
        
            <h1>Success Story - Edit</h1>
            
            <g:if test="${flash.message}">
            	<div class="message">${flash.message}</div>
            </g:if>
            
            <g:hasErrors bean="${story}">
				<div class="errors">
					<g:renderErrors bean="${story}" as="list" />
				</div>
            </g:hasErrors>
            
            <g:form method="post" >
            
                <input type="hidden" name="id" value="${story?.id}" />
                
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title">Title:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:story,field:'title','errors')}">
                                    <input type="text" size="70" maxlength="100" id="title" name="title" value="${fieldValue(bean:story,field:'title')}"/>
                                </td>
                                <td valign="top" class="value" rowspan="6">
                                	Default Picture:<br>
									<g:if test="${story.defaultPictureName == null}">
										<br><div class="message">no default image currently assigned to this story</div>
									</g:if>
									<g:else>
										<img src="/smf/images/${story.defaultPictureName}" style="max-width: 300px"/>
									</g:else>
                                </td>
                            </tr> 
                            
                            <tr class="prop">
								<td valign="top" class="name">
									<label for="videoUrl">Video Url:</label>
								</td>
								<td valign="top" class="value ${hasErrors(bean:story,field:'videoUrl','errors')}">
									<textarea rows="4" cols="80" name="videoUrl">${story?.videoUrl?.encodeAsHTML()}</textarea>
								</td>
                            </tr> 
                            
                            <tr class="prop">
								<td valign="top" class="name">
									<label for="enabled">Enabled:</label>
								</td>
								<td valign="top" class="value ${hasErrors(bean:story,field:'enabled','errors')}">
									<g:checkBox name="enabled" value="${story?.enabled}" ></g:checkBox>
								</td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="introduction">Introduction:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:story,field:'introduction','errors')}">
                                    <textarea rows="5" cols="80" name="introduction">${story?.introduction?.encodeAsHTML()}</textarea>
                                </td>
                            </tr> 
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="body">Body:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:story,field:'body','errors')}">
                                    <textarea rows="10" cols="80" name="body">${story?.body?.encodeAsHTML()}</textarea>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
								<td valign="top" class="name">Additional<br>Images:</td>
								<td valign="top" class="value" colspan="3">
									<g:each var="storyImage" in="${story.storyImage}">
										<img src="/smf/images/${storyImage.pictureName}" height="120"/ align="top">
									</g:each>
								</td>                     
							</tr>
                        
                        </tbody>
                        
                    </table>
                </div>
                
                <span class="button"><g:actionSubmit action="storyUpdate" value="save changes" /></span>
                
 
                
            </g:form>
        </div>
    </body>
</html>
